<?php
class Site_Model_GetAddress
{
	private $cep;
	
	public function __construct($_cep)
	{
		$this->cep = $_cep;
	}
	
	public function getAddress()
	{
    	$url = "http://ceplivre.com.br/consultar/cep/eb84faf2e8f6c3e6b39c1dc890fa45ee/{$this->cep}/json";

    	$ch = curl_init();
        curl_setopt ($ch, CURLOPT_URL, $url);
        curl_setopt ($ch, CURLOPT_HEADER, 0);
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 0);
        $addr = curl_exec($ch);
        curl_close($ch);
        
        return $addr;
	}
}
